Implementing Fast Java Monitors with Relaxed-Locks
نویسنده
چکیده
The Java Programming Language permits synchronization operations (lock, unlock, wait, notify) on any object. Synchronization is very common in applications and is endemic in the library code upon which applications depend. It is therefore critical that a monitor implementation be both space-efficient and time-efficient. We present a locking protocol, the Relaxed-Lock, that satisfies those requirements. The Relaxed-Lock is reasonably compact, using only one machine word in the object header. It is fast, requiring in the uncontested case only one atomic compare-and-swap to lock a monitor and no atomic instructions to release a monitor. The Relaxed-Lock protocol is unique in that it admits a benign data race in the monitor unlock path (hence its name) but detects and recovers from the race and thus maintains correct mutual exclusion. We also introduce speculative deflation, a mechanism for releasing a monitor when it is no longer needed.
منابع مشابه
Transparently Reconciling Transactions with Locking for Java Synchronization
Concurrent data accesses in high-level languages like Java and C# are typically mediated using mutual-exclusion locks. Threads use locks to guard the operations performed while the lock is held, so that the lock’s guarded operations can never be interleaved with operations of other threads that are guarded by the same lock. This way both atomicity and isolation properties of a thread’s guarded ...
متن کاملA fast and precise analysis for data race detection
When two threads access the shared memory without being synchronized, and at least one performs a write operation, they form a data race. Data races are widely considered the symptom of bugs in multithreaded programs, and a huge amount of work has been done in order to detect them. The key issue in order to statically discover data races via abstract interpretation in Java programs is to develo...
متن کاملActiveMonitor: Non-blocking Monitor Executions for Increased Parallelism
We present a set of novel ideas on design and implementation of monitor objects for multi-threaded programs. Our approach has two main goals: (a) increase parallelism in monitor objects and thus provide performance gains (shorter runtimes) for multi-threaded programs, and (b) introduce constructs that allow programmers to easily write monitor-based multi-threaded programs that can achieve these...
متن کاملFast Multi-Level Locks for Java A Preliminary Performance Evaluation
Atomic sections guarantee atomic and isolated execution of a block of code. Transactional Memory can be used to implement them but suffers from the inability to support system calls and has high overhead. Lock inference is a pessimistic alternative that infers the locks necessary to prevent thread interference. Our research looks at lock inference techniques for Java programs. An important aspe...
متن کاملRevocation techniques for Java concurrency
This paper proposes two approaches to managing concurrency in Java using a guarded region abstraction. Both approaches use revocation of such regions – the ability to undo their effects automatically and transparently. These new techniques alleviate many of the constraints that inhibit construction of transparently scalable and robust concurrent applications. The first solution, revocable monit...
متن کامل